<template>
  <div class="list-table">
    <div class="area-header">
      <span class="area-header-title">{{ $t('股权项目投资情况简表') }}</span>
    </div>
    <el-form ref="queryForm" :model="queryParams" :inline="true">
      <el-form-item :label="$t('项目名称')" prop="dealName">
        <el-input v-model="queryParams.dealName" :placeholder="$t('项目名称')" clearable @keyup.enter.native="queryHandle" />
      </el-form-item>
      <el-form-item :label="$t('标的公司名称')" prop="companyName">
        <el-input v-model="queryParams.companyName" :placeholder="$t('标的公司名称')" clearable @keyup.enter.native="queryHandle" />
      </el-form-item>
      <el-form-item :label="$t('项目负责人')" prop="personChargeName">
        <el-input v-model="queryParams.personChargeName" :placeholder="$t('项目负责人')" clearable @keyup.enter.native="queryHandle" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="queryHandle">{{ $t("搜索") }}</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{ $t("重置") }}</el-button>
        <el-button
          v-hasPermi="['deal:brieftable:exportReport']"
          type="warning"
          icon="el-icon-download"
          size="mini"
          @click="exportHandle"
        >{{ $t("导出") }}</el-button>
      </el-form-item>
    </el-form>
    <el-table v-loading="loading" :data="list" border>
      <el-table-column :label="$t('项目名称')" align="center" prop="dealName" show-overflow-tooltip width="150">
        <template slot-scope="scope">
          <router-link
            target="_blank"
            :to="{path:'/deal/home/dealBaseHome',query:{id:scope.row.dealId,companyId:scope.row.companyId}}"
            class="link_a"
          >{{ scope.row.dealName }}</router-link>
        </template>
      </el-table-column>
      <el-table-column :label="$t('标的公司名称')" align="center" prop="companyName" show-overflow-tooltip width="150">
        <template slot-scope="scope">
          <router-link
            target="_blank"
            :to="{path:'/company/base/companyBaseHome',query:{companyId:scope.row.companyId}}"
            class="link_a"
          >{{ scope.row.dealName }}</router-link>
        </template>
      </el-table-column>
      <el-table-column :label="$t('项目负责人')" align="center" prop="personChargeName" show-overflow-tooltip width="100" />
      <el-table-column :label="$t('预计投资金额') + this.$t('金额单位')" align="center" prop="amountInvestmentEstimate">
        <template slot-scope="scope">
          <span class="money-text">{{ moneyFormat(scope.row.amountInvestmentEstimate, 'w') }}</span>
        </template>
      </el-table-column>
      <el-table-column :label="$t('项目简介')" align="center" prop="dealIntroduction" show-overflow-tooltip />
      <el-table-column :label="$t('首次项目估值') + this.$t('金额单位')" align="center" prop="firstProjectValuation">
        <template slot-scope="scope">
          <span class="money-text">{{ moneyFormat(scope.row.firstProjectValuation, 'w') }}</span>
        </template>
      </el-table-column>
      <el-table-column :label="$t('首次持股比例') + '(%)'" align="center" prop="firstShareholdingRatio" />
      <el-table-column :label="$t('最新项目估值') + this.$t('金额单位')" align="center" prop="latestDealIntroduction">
        <template slot-scope="scope">
          <span class="money-text">{{ moneyFormat(scope.row.latestDealIntroduction, 'w') }}</span>
        </template>
      </el-table-column>
      <el-table-column :label="$t('最新持股比例') + '(%)'" align="center" prop="latestShareholdingRatio" />
      <!--      <el-table-column :label="$t('退出方式')" align="center" prop="exitMode" show-overflow-tooltip />-->
      <!--      <el-table-column :label="$t('退出金额') + this.$t('金额单位')" align="center" prop="draftExitPrice">-->
      <!--        <template slot-scope="scope">-->
      <!--          <span class="money-text">{{ moneyFormat(scope.row.draftExitPrice, 'w') }}</span>-->
      <!--        </template>-->
      <!--      </el-table-column>-->
    </el-table>
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
  </div>
</template>

<script>

import { getEquityBriefTableReport } from '@/api/base/deal/dealBase'
import { downLoadFileOpen } from '@/utils/zipdownload'

export default {
  name: 'EquityBriefTableReport',
  data() {
    return {
      list: [],
      total: 0,
      loading: false,
      queryParams: {
        pageNum: 1,
        pageSize: 10
      }
    }
  },
  mounted() {
    this.getList()
  },
  methods: {
    getList() {
      this.loading = true
      getEquityBriefTableReport(this.queryParams).then(res => {
        this.list = res.rows
        this.total = res.total
        this.loading = false
      })
    },
    /** 搜索按钮操作 */
    queryHandle() {
      this.queryParams.pageNum = 1
      this.getList()
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm('queryForm')
      this.queryHandle()
    },
    exportHandle() {
      var _this = this
      const query = this.queryParams
      this.$confirm(this.$t('是否确认导出?'), this.$t('警告'), {
        confirmButtonText: this.$t('确定'),
        cancelButtonText: this.$t('取消'),
        type: 'warning'
      }).then(function() {
        var dealName = _this.isEmpty(query.dealName) ? '' : query.dealName
        var companyName = _this.isEmpty(query.companyName) ? '' : query.companyName
        var personChargeName = _this.isEmpty(query.personChargeName) ? '' : query.personChargeName
        var param = '?dealName=' + dealName + '&companyName=' + companyName + '&personChargeName=' + personChargeName
        return downLoadFileOpen('/deal/dealBase/exportReport' + param)
      }).catch(function() {
      })
    }
  }
}
</script>

<style scoped>

</style>
